[id].vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation1></HomePageNavigation1>
  6. <!-- 广告1 -->
  7. <HomeAdvertising :imgurl="adImg1"></HomeAdvertising>
  8. <!-- 资讯列表 -->
  9. <div class="newsDetail">
  10. <div class="inner">
  11. <div class="innerLeft">
  12. <!-- 面包屑导航 -->
  13. <div class="breadcrumb phone_none">
  14. <div class="inner">
  15. <span class="location">当前位置:</span>
  16. <el-breadcrumb :separator-icon="ArrowRight">
  17. <el-breadcrumb-item>
  18. <NuxtLink to="/">首页</NuxtLink>
  19. </el-breadcrumb-item>
  20. <el-breadcrumb-item v-if="parent_name != ''">
  21. <NuxtLink :to="`/${parent_pinyin}/index.html`"> {{ parent_name }}</NuxtLink>
  22. </el-breadcrumb-item>
  23. <el-breadcrumb-item>{{ routeNewsTtitle }}</el-breadcrumb-item>
  24. </el-breadcrumb>
  25. </div>
  26. </div>
  27. <div class="breadcrumb_box pc_none">
  28. <span class=" ">当前位置:</span>
  29. <NuxtLink to="/">首页</NuxtLink>
  30. <span class=" " v-if="parent_name != ''">&gt;</span>
  31. <NuxtLink :to="`/${parent_pinyin}/index.html`" v-if="parent_name != ''"> {{ parent_name }}</NuxtLink>
  32. <span class=" ">&gt;</span>
  33. {{ routeNewsTtitle }}
  34. </div>
  35. <div class="LeftTop">
  36. <h1>{{ newsDetail.title }}</h1>
  37. <p class="phone_none">
  38. 来源: <span>{{ newsDetail.copyfrom }}</span>
  39. 作者: <span>{{ newsDetail.author }}</span>
  40. 发布时间: <span>{{ time }}</span>
  41. </p>
  42. <p class="pc_none">
  43. <span>{{ newsDetail.copyfrom }}</span>
  44. <span>{{ newsDetail.author }}</span>
  45. <span>{{ time }}</span>
  46. </p>
  47. </div>
  48. <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content" @click="openPreview">
  49. </div>
  50. <div v-if="previewVisible" class="preview-modal" @click="closePreview">
  51. <img :src="selectedImage" alt="Preview">
  52. </div>
  53. <!-- 免责声明: -->
  54. <div class="disclaimer" v-if="newsDetail.copyfrom != '本网'">
  55. <p>原文链接:{{ newsDetail.fromurl }}</p>
  56. <p>[免责声明]本文来源于网络转载,仅供学习交流使用,不构成商业目的。 版权归原作者所有,如涉及作品内容,版权和其他问题,请在30日与本网联系,我们将第一时间处理。</p>
  57. </div>
  58. <div v-if="articleChoice">
  59. <!-- 投票 start ---------------------------------------->
  60. <div class="index_3_box_vote" v-if="articleChoice">
  61. <div class="voteTitle">投票区</div>
  62. <div class="inquire">
  63. <p v-if="voteList.length > 0">{{ voteList[0].survey_name }}</p>
  64. <div class="radioBox">
  65. <!--投票选项-->
  66. <div v-if="!isDisabled">
  67. <div class="radio" v-if="isRadio">
  68. <el-radio-group v-model="radio1" @change="handleRadioChange">
  69. <el-radio v-for="item in voteList" :key="item.id" :value="item.id"
  70. size="large">
  71. <span v-if="item.is_other == 0">{{ item.choice_name }}</span>
  72. <span v-else>其他</span>
  73. </el-radio>
  74. </el-radio-group>
  75. <el-input v-if="showUserChoice" v-model="userChoice" :rows="2" type="textarea"
  76. resize="none" placeholder="请输入.." />
  77. </div>
  78. <div class="checkInputBox" v-else>
  79. <el-checkbox-group v-model="check1" @change="handleCheckboxChange">
  80. <span v-for="item in voteList" :key="item.id">
  81. <span v-if="item.is_other == 0">
  82. <el-checkbox size="large" :label="item.choice_name"
  83. :value="item.id" />
  84. </span>
  85. <span v-else>
  86. <el-checkbox size="large" label="其他" :value="item.id" />
  87. </span>
  88. </span>
  89. </el-checkbox-group>
  90. <el-input v-if="showUserChoice" v-model="userChoice" :rows="2" type="textarea"
  91. resize="none" placeholder="请输入.." />
  92. </div>
  93. </div>
  94. <!--投票结果-->
  95. <div class="inquireData" v-else>
  96. <div v-for="item in websiteSurveyData.data" :key="item.id">
  97. <div class="inquireDataItem active" v-if="item.status == 1">
  98. <div class="inquireDataItemTitle">
  99. <span v-if="item.choice_name == ''">其他</span>
  100. <span v-else>{{ item.choice_name }}</span>
  101. </div>
  102. <div class="inquireDataItemNum">{{ item.results }}票</div>
  103. </div>
  104. <div class="inquireDataItem" v-else>
  105. <div class="inquireDataItemTitle">
  106. <span v-if="item.choice_name == ''">其他</span>
  107. <span v-else>{{ item.choice_name }}</span>
  108. </div>
  109. <div class="inquireDataItemNum">{{ item.results }}票</div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <div class="btn">
  115. <button class="voting" @click="addWebsiteSurvey" :disabled="isDisabled"
  116. v-if="!isDisabled">投票</button>
  117. </div>
  118. </div>
  119. </div>
  120. <!-- 投票 end ---------------------------------------->
  121. </div>
  122. <!-- 推荐阅读 -->
  123. <div class="recommendRead" v-if="newsDetail.commendArticle != false">
  124. <div class="recommendReadTitle phone_none">
  125. 推荐阅读
  126. </div>
  127. <div class="recommend_read_head_box pc_none">
  128. <span class="recommend_read_head">
  129. 推荐阅读
  130. </span>
  131. </div>
  132. <div class="recommendReadList">
  133. <div class="recommendReadListTitle" v-for="(item, index) in newsDetail.commendArticle"
  134. :key="item.id">
  135. <a :href="`/${item.alias_pinyin}/${item.id}.html`" v-if="index < 3">
  136. {{ item.title }}
  137. </a>
  138. <span v-if="index < 3">{{ getTime(item.created_at, "month", 1) }}</span>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <div class="innerRight">
  144. <!-- 热点资讯1 -->
  145. <div class="hotList1">
  146. <DetailHotNews></DetailHotNews>
  147. </div>
  148. <!-- 热点资讯2 -->
  149. <div class="hotList2">
  150. <DetailHotNews2></DetailHotNews2>
  151. </div>
  152. </div>
  153. </div>
  154. </div>
  155. <!-- 广告2 -->
  156. <HomeAdvertising :imgurl="adImg2"></HomeAdvertising>
  157. <!-- 页面底部 -->
  158. <HomeFoot1></HomeFoot1>
  159. </template>
  160. <script setup>
  161. //1.页面依赖 start ---------------------------------------->
  162. import { onMounted } from 'vue'
  163. import { ElBreadcrumb, ElBreadcrumbItem, ElRadio, ElRadioGroup, ElCheckbox, ElCheckboxGroup, ElMessage, ElInput } from 'element-plus'
  164. import { ArrowRight } from '@element-plus/icons-vue'
  165. //1.页面依赖 end ---------------------------------------->
  166. //2.页面路径 start ---------------------------------------->
  167. const targetSegment = getRoutePath(1);
  168. let routeId;
  169. //通过导航路径反向查询导航id
  170. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  171. method: 'GET',
  172. query: {
  173. 'pinyin': targetSegment,
  174. },
  175. });
  176. if (getRouteId.code == 200) {
  177. routeId = getRouteId.data.category_id
  178. } else {
  179. console.log("错误位置:获得页面路径")
  180. }
  181. //2.页面路径 start ---------------------------------------->
  182. //3.面包屑 start ---------------------------------------->
  183. const route = useRoute();
  184. const articleId = parseInt(route.params.id); //获得该页面的id
  185. //3.1 获得父级栏目的名称、id
  186. const parent_name = ref([]);
  187. const parent_id = ref([]);
  188. const parent_pinyin = ref("");
  189. const parent_children_count = ref(0)
  190. let getParentNav = async () => {
  191. const listData = await requestDataPromise('/web/getOneWebsiteCategory', {
  192. method: 'GET',
  193. query: {
  194. 'catid': routeId
  195. },
  196. });
  197. if (listData.code == 200) {
  198. parent_name.value = listData.data.alias;
  199. parent_id.value = listData.data.parent_id;
  200. parent_pinyin.value = listData.data.aLIas_pinyin;
  201. parent_children_count.value = listData.data.children_count;
  202. } else {
  203. console.log("错误位置:获取面包屑导航")
  204. }
  205. }
  206. getParentNav();
  207. //3.页面依赖 end ---------------------------------------->
  208. //4.页面数据 start ---------------------------------------->
  209. //4.1 资讯详情
  210. const newsDetail = ref({})
  211. const routeNewsTtitle = ref("");
  212. //4.2 发布日期
  213. const time = ref("");
  214. //4.3 路径
  215. const routLevelTitle = ref("");
  216. const routLevelId = ref("");
  217. //4.4 是否展示投票
  218. const articleChoice = ref(false);
  219. //4.5 获取详情
  220. async function getPageData() {
  221. const mkdata = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  222. method: 'GET',
  223. query: {
  224. 'articleid': articleId
  225. },
  226. });
  227. if (mkdata.code == 200) {
  228. //判断是否显示投票
  229. if (mkdata.data.is_survey == 1) {
  230. console.log("本篇文章含有投票!")
  231. articleChoice.value = true;
  232. getVoteList();
  233. }
  234. //获取内容
  235. newsDetail.value = mkdata.data;
  236. //获取路径
  237. routLevelTitle.value = newsDetail.value.cat_name;
  238. routLevelId.value = newsDetail.value.category_id;
  239. //获取发布时间
  240. time.value = newsDetail.value.updated_at.split(' ')[0];
  241. //修正标题长度
  242. if (newsDetail.value.title.length >= 20) {
  243. routeNewsTtitle.value = newsDetail.value.title.substr(0, 20) + "...";
  244. } else {
  245. routeNewsTtitle.value = newsDetail.value.title
  246. }
  247. } else {
  248. console.log("错误位置:获取详情内容")
  249. }
  250. }
  251. getPageData();
  252. //4.页面数据 end ---------------------------------------->
  253. //5.广告 start ---------------------------------------->
  254. let adImg1 = ref([]);
  255. let adImg2 = ref([]);
  256. onMounted(async () => {
  257. const { $webUrl, $CwebUrl } = useNuxtApp();
  258. //广告1
  259. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_detail_0001`
  260. const responseAd1 = await fetch(url, {
  261. headers: {
  262. 'Content-Type': 'application/json',
  263. 'Userurl': $CwebUrl,
  264. 'Origin': $CwebUrl
  265. }
  266. });
  267. const resultAd1 = await responseAd1.json();
  268. adImg1.value = resultAd1.data[0];
  269. //广告2
  270. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=nmw_detail_0002`
  271. const responseAd2 = await fetch(url2, {
  272. headers: {
  273. 'Content-Type': 'application/json',
  274. 'Userurl': $CwebUrl,
  275. 'Origin': $CwebUrl
  276. }
  277. });
  278. const resultAd2 = await responseAd2.json();
  279. adImg2.value = resultAd2.data[0];
  280. })
  281. //5.广告 end ---------------------------------------->
  282. //6.设置seo信息 start---------------------------------------->
  283. const setData = await requestDataPromise('/web/selectWebsiteArticleInfo', {
  284. method: 'GET',
  285. query: {
  286. 'articleid': articleId
  287. },
  288. });
  289. if (setData.code == 200) {
  290. let seoTitle = setData.data.title;
  291. let seoDescription = setData.data.introduce;
  292. let seoKeywords = setData.data.keyword;
  293. let seoSuffix = setData.data.suffix;
  294. let seoName = setData.data.website_name;
  295. useSeoMeta({
  296. title: seoTitle + "_" + seoName + "_" + seoSuffix,
  297. meta: [
  298. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  299. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  300. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  301. ]
  302. });
  303. } else {
  304. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  305. console.log("错误位置:设置详情页面SEO数据")
  306. console.log("后端错误反馈:", setData.message)
  307. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  308. }
  309. //6.设置seo信息 end---------------------------------------->
  310. //7.投票 start---------------------------------------->
  311. const radio1 = ref(''); //单选
  312. const check1 = ref([]); //多选
  313. const isDisabled = ref(false);//是否禁用提交按钮
  314. const isRadio = ref(true);//是否渲染单选
  315. const userSurId = ref('');//投票属于哪一篇文章
  316. const userChoice = ref('');//用于判断用户选择了其他选项以后,输入的值
  317. const userIsChoice = ref('');//用于判断其他选项目前是什么值
  318. const showUserChoice = ref(false);//是否显示其他输入框
  319. const websiteSurveyData = ref([]);//投票结果
  320. //7.2获得投票列表
  321. let voteList = ref([]);
  322. async function getVoteList() {
  323. const voteData = await requestHome('/web/getWebsiteSurvey', { method: 'GET', query: { 'art_id': articleId } });
  324. console.log(778899)
  325. console.log(voteData)
  326. if (voteData.code == 200) {
  327. voteList.value = voteData.data;
  328. console.log(voteList.value)
  329. //判断显示单选还是多选
  330. //survey_type 0是单选 1是多选
  331. if (voteData.data[0].survey_type == 0) {
  332. isRadio.value = true;
  333. console.log("1111")
  334. } else {
  335. isRadio.value = false;
  336. }
  337. //把最后一个的值拿出来 用于判断用户是否选择了其他
  338. for (let item of voteData.data) {
  339. //如果含有其他
  340. if (item.is_other == 1) {
  341. userIsChoice.value = item.id;
  342. }
  343. }
  344. //用户投票属于哪一篇文章
  345. userSurId.value = voteData.data[0].sur_id;
  346. } else {
  347. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  348. // console.log("错误位置:首页投票")
  349. // console.log("后端错误反馈:", voteData.message)
  350. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  351. }
  352. }
  353. //7.3当用户选择了选项,判断是否展示其他输入框
  354. const handleRadioChange = (value) => {
  355. if (value == userIsChoice.value) {
  356. showUserChoice.value = true;
  357. } else {
  358. showUserChoice.value = false;
  359. }
  360. }
  361. const handleCheckboxChange = (value) => {
  362. if (value.includes(userIsChoice.value)) {
  363. showUserChoice.value = true;
  364. } else {
  365. showUserChoice.value = false;
  366. }
  367. }
  368. //7.4发起投票
  369. async function addWebsiteSurvey() {
  370. //判断当前是单选还是多选
  371. console.log(isRadio.value)
  372. if (isRadio.value) {
  373. console.log("用户单选!")
  374. if (radio1.value != '') {
  375. //先判断一下是否使用了其他选项
  376. if (showUserChoice.value) {
  377. if (userChoice.value != '') {
  378. //文章id
  379. // console.log(userSurId.value)
  380. // 用户输入的值
  381. // console.log(userChoice.value)
  382. //如果使用了其他,其他的选项需要增加进去
  383. const ChoiceData = await requestHome('/web/addWebsiteSurveyOption', {
  384. method: 'GET',
  385. query: {
  386. 'sur_id': userSurId.value,//投票的新闻id
  387. 'choice_name': userChoice.value,//投票的选项id
  388. }
  389. });
  390. if (ChoiceData.code == 200) {
  391. //提交完其他选项以后,再正式发起投票
  392. const mkData = await requestHome('/web/addWebsiteSurveyVote', {
  393. method: 'GET',
  394. query: {
  395. 'sur_id': userSurId.value,
  396. 'choice_id': ChoiceData.data
  397. }
  398. });
  399. if (mkData.code == 200) {
  400. ElMessage.success('投票成功!')
  401. //把投票结果显示到页面上 禁用投票按钮
  402. isDisabled.value = true;
  403. websiteSurveyData.value = mkData.data;
  404. //遍历一下,把用户选中的那个设置status为1
  405. let data = mkData.data;
  406. //遍历一下,把用户选中的那个设置status为1
  407. for (let item of data.data) {
  408. for (let i of data.choice) {
  409. if (item.id == i) {
  410. console.log(item.id)
  411. item.status = 1;
  412. }
  413. }
  414. }
  415. websiteSurveyData.value = data;
  416. } else {
  417. ElMessage.error(mkData.message)
  418. }
  419. } else {
  420. ElMessage.error('其他投票失败!')
  421. }
  422. } else {
  423. ElMessage.error('请输入选项内容!')
  424. }
  425. } else {
  426. //如果没选择其他,直接提交选择的内容
  427. const mkData = await requestHome('/web/addWebsiteSurveyVote', {
  428. method: 'GET',
  429. query: {
  430. 'sur_id': userSurId.value,
  431. 'choice_id': radio1.value
  432. }
  433. });
  434. if (mkData.code == 200) {
  435. ElMessage.success('投票成功!')
  436. //把投票结果显示到页面上 禁用投票按钮
  437. isDisabled.value = true;
  438. let data = mkData.data;
  439. //遍历一下,把用户选中的那个设置status为1
  440. for (let item of data.data) {
  441. for (let i of data.choice) {
  442. if (item.id == i) {
  443. item.status = 1;
  444. }
  445. }
  446. }
  447. websiteSurveyData.value = data;
  448. } else {
  449. ElMessage.error('投票失败!')
  450. }
  451. }
  452. } else {
  453. ElMessage.error('请选择一个选项')
  454. }
  455. } else {
  456. console.log("多选!")
  457. //多选
  458. if (check1.value != []) {
  459. //先判断一下是否使用了其他选项
  460. if (showUserChoice.value) {
  461. if (userChoice.value != '') {
  462. //判断用户是否只选择了一个其他
  463. if (check1.value.length == 1) {
  464. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption', {
  465. method: 'GET',
  466. query: {
  467. 'sur_id': userSurId.value,//投票的新闻id
  468. 'choice_name': userChoice.value,//用户输入的其他选项文字
  469. }
  470. });
  471. if (ChoiceData.code == 200) {
  472. //提交完其他选项以后,再正式发起投票
  473. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  474. method: 'GET',
  475. query: {
  476. 'sur_id': userSurId.value,
  477. 'choice_id': ChoiceData.data
  478. }
  479. });
  480. if (mkData.code == 200) {
  481. ElMessage.success('投票成功!')
  482. //把投票结果显示到页面上 禁用投票按钮
  483. isDisabled.value = true;
  484. websiteSurveyData.value = mkData.data;
  485. //遍历一下,把用户选中的那个设置status为1
  486. let data = mkData.data;
  487. //遍历一下,把用户选中的那个设置status为1
  488. for (let item of data.data) {
  489. for (let i of data.choice) {
  490. if (item.id == i) {
  491. console.log(item.id)
  492. item.status = 1;
  493. }
  494. }
  495. }
  496. websiteSurveyData.value = data;
  497. } else {
  498. ElMessage.error(mkData.message)
  499. }
  500. } else {
  501. ElMessage.error('其他投票失败!')
  502. }
  503. } else {
  504. //用户选择了除了其他以外,还包括别的选项
  505. const ChoiceData = await requestDataPromise('/web/addWebsiteSurveyOption', {
  506. method: 'GET',
  507. query: {
  508. 'sur_id': userSurId.value,//投票的新闻id
  509. 'choice_name': userChoice.value,//用户输入的其他选项文字
  510. }
  511. });
  512. if (ChoiceData.code == 200) {
  513. let data = check1.value;
  514. //找到多选的数组,把其他默认值给替换掉
  515. for (let i = 0; i < data.length; i++) {
  516. if (data[i] == userIsChoice.value) {
  517. data[i] = ChoiceData.data;
  518. }
  519. }
  520. let jsonArray = JSON.stringify(data);
  521. //提交完其他选项以后,再正式发起投票
  522. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  523. method: 'GET',
  524. query: {
  525. 'sur_id': userSurId.value,
  526. 'choice_id': jsonArray
  527. }
  528. });
  529. if (mkData.code == 200) {
  530. ElMessage.success('投票成功!')
  531. //把投票结果显示到页面上 禁用投票按钮
  532. isDisabled.value = true;
  533. websiteSurveyData.value = mkData.data;
  534. //遍历一下,把用户选中的那个设置status为1
  535. let data = mkData.data;
  536. //遍历一下,把用户选中的那个设置status为1
  537. for (let item of data.data) {
  538. for (let i of data.choice) {
  539. if (item.id == i) {
  540. //console.log(item.id)
  541. item.status = 1;
  542. }
  543. }
  544. }
  545. websiteSurveyData.value = data;
  546. } else {
  547. ElMessage.error(mkData.message)
  548. }
  549. } else {
  550. ElMessage.error('其他投票失败!')
  551. }
  552. }
  553. } else {
  554. ElMessage.error('请输入选项内容!')
  555. }
  556. } else {
  557. let jsonArray = JSON.stringify(check1.value);
  558. //如果没选择其他,直接提交选择的内容
  559. const mkData = await requestDataPromise('/web/addWebsiteSurveyVote', {
  560. method: 'GET',
  561. query: {
  562. 'sur_id': userSurId.value,
  563. 'choice_id': jsonArray
  564. }
  565. });
  566. if (mkData.code == 200) {
  567. ElMessage.success('投票成功!')
  568. //把投票结果显示到页面上 禁用投票按钮
  569. isDisabled.value = true;
  570. websiteSurveyData.value = mkData.data;
  571. //遍历一下,把用户选中的那个设置status为1
  572. let data = mkData.data;
  573. //遍历一下,把用户选中的那个设置status为1
  574. for (let item of data.data) {
  575. for (let i of data.choice) {
  576. if (item.id == i) {
  577. console.log(item.id)
  578. item.status = 1;
  579. }
  580. }
  581. }
  582. websiteSurveyData.value = data;
  583. } else {
  584. ElMessage.error('投票失败!')
  585. }
  586. }
  587. } else {
  588. ElMessage.error('请选择一个选项')
  589. }
  590. }
  591. }
  592. //7.投票 end---------------------------------------->
  593. //8.页面图片放大 start---------------------------------------->
  594. const previewVisible = ref(false)
  595. const selectedImage = ref(' ')
  596. const openPreview = (event) => {
  597. if (event.target.tagName === 'IMG') {
  598. selectedImage.value = event.target.src;
  599. previewVisible.value = true;
  600. }
  601. }
  602. const closePreview = () => {
  603. previewVisible.value = false;
  604. }
  605. //8.页面图片放大 end---------------------------------------->
  606. </script>
  607. <style lang="less" scoped>
  608. @import url('@/assets/css/detail.less');
  609. </style>
  610. <style lang="less" scoped>
  611. @media screen and (min-width:801px){/*pc*/
  612. .pc_none{display:none;}
  613. }
  614. @media screen and (max-width:800px){/*ipad_phone*/
  615. .breadcrumb_box{
  616. height:22px;width:100%;margin:15px auto 0px;
  617. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  618. font-size:14px;
  619. color:#666;
  620. *{
  621. font-size:14px;
  622. display:inline ;
  623. color:#666;
  624. line-height:22px;height:22px;
  625. margin-right:5px;
  626. }
  627. }
  628. .newsDetail .inner{width:92%;}
  629. .newsDetail .inner .innerLeft{width:100%;float:none;margin:0px auto;}
  630. .newsDetail .inner .innerLeft .LeftTop > h1{font-size:20px;line-height:28px;margin-bottom:15px;}
  631. .newsDetail .inner .innerLeft .leftBottom{width:100%;margin-bottom:14px;}
  632. .newsDetail .inner .innerLeft .leftBottom *,.newsDetail .inner .innerLeft .leftBottom{line-height:24px!important;font-size:16px;background:rgba(0,0,0,0);}
  633. .newsDetail .inner .innerLeft .leftBottom /deep/img{display:block;width:100%;height:auto;}
  634. .newsDetail .inner .innerLeft .disclaimer{width:100%;}
  635. .newsDetail .inner .innerLeft .disclaimer *{
  636. word-wrap: break-word;width:100%!important;display:block!important;
  637. overflow-wrap: break-word;font-size:16px;
  638. white-space: pre-wrap;
  639. word-break: break-all;
  640. }
  641. .newsDetail{margin-bottom:10px;}
  642. .newsDetail .inner .innerLeft .LeftTop{border-top:solid 1px #dd7d18;margin-top:10px;padding-top:15px;}
  643. // 推荐阅读
  644. .index_3_box_vote{overflow:hidden;margin-top:39px;}
  645. .index_3_box_vote .inquire{margin-top:15px;height:auto;}
  646. .index_3_box_vote .inquire p{height:auto;padding:0;font-size:14px;
  647. margin:0px 0px 5px 18px;}
  648. .index_3_box_vote .inquire .radio .el-radio.el-radio--large .el-radio__label span{font-size:14px;}
  649. .index_3_box_vote .voteTitle{font-size:14px;}
  650. .index_3_box_vote .inquire .btn{padding-left:22px;}
  651. .index_3_box_vote .inquire .radio .el-radio.el-radio--large{margin-bottom:3px;}
  652. .index_3_box_vote .inquire .radioBox{height:auto;
  653. padding:0px 0px 12px 18px;}
  654. .index_3_box_vote .inquire .radio .el-radio-group{width:100%;}
  655. .index_3_box_vote .inquire .btn button{width:auto;padding:0px 10px;line-height:33px;height:33px;font-size:14px;margin-bottom:14px;}
  656. .newsDetail .inner .innerLeft .recommendRead{width:100%; margin:25px auto 32px;border:none;}
  657. .newsDetail .inner .innerLeft .recommendRead .recommendReadTitle{width:100%;margin:22px 0px;}
  658. .recommend_read_head_box{overflow:hidden;border-bottom:1px solid #D9D9D9;}
  659. .recommend_read_head{
  660. width:auto;font-size:14px;box-sizing:border-box;height:33px;line-height:33px;
  661. color: #dd7d18;
  662. border-bottom:1px solid #dd7d18;float:left;
  663. }
  664. .newsDetail .inner .innerLeft .recommendRead .recommendReadList{
  665. height:auto;margin-top:11px; min-height:auto;padding-bottom:8px;
  666. }
  667. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle{
  668. margin-top:0px;overflow:hidden;width:100%;
  669. }
  670. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle a{
  671. line-height:33px;height:33px;font-size:14px;float:left;max-width:90%;
  672. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  673. }
  674. .newsDetail .inner .innerLeft .LeftTop > p span:nth-last-of-type(1){margin-right:0px;}
  675. .newsDetail .inner .innerLeft .LeftTop > p { height:auto;overflow:hidden; }
  676. .newsDetail .inner .innerLeft .recommendRead .recommendReadList .recommendReadListTitle span{display:none;}
  677. .newsDetail .inner .innerRight{display:none;}
  678. .phone_none{display:none;}
  679. }
  680. </style>